<?php

header("content-type:text/html;charset=utf-8");

$link=mysqli_connect("localhost",'root','',"show1");

mysqli_set_charset($link,'utf8');

$sql="select * from good2";

$result=mysqli_query($link,$sql);

$ar1=[];

while($row=mysqli_fetch_assoc($result)){
    //把遍历出来的数据追加到数组中
    array_push($ar1,$row);
}

echo json_encode($ar1);

mysqli_close($link);

?>